package org.hyl.javabase.接口;


//讲引用与值传递的区别
//引用传递主要是传对象的地址，值传递主要是传变量的值
public class demo {
   public static void main(String[] arg){	 
	   demo p=new demo();
	   p.fun5();
   }
   public void fun1(){
	   
	   int i=8;
	   System.out.println("i:"+i);	  
	   fun2_1(i);
	   System.out.println("i:"+i);	  
	   
	   
	   //实例化 car
	   car c= new car();  
	   c.name="8";
	   System.out.println("name:"+c.name);	  
	   fun2_2(c);  //  传入 car的实例化对象
	   System.out.println("name:"+c.name);	  
	
   }
   
   public  void fun2_2( car c1 ){	 
	   //注意属性的变化
	   c1.name="9";	
   }
   
   
   public void fun2_1(int i){	   
	   i=9;
   }
   
   public int fun3(){
	    int i=9;
	    return i;
	   
   }
   
   public void fun4(){
	   car a=new car();
	   a.name="hq1";
	   car a1=a;
	   car a2=a;
	   car a3=a;

	   
	   System.out.println("name:"+a1.name);	 
	   System.out.println("name:"+a2.name);	 
	   System.out.println("name:"+a3.name);	 
	   
	   
	   
   }
   
   public void fun5(){
	int i=9;
	 
	int i1=i;
	i=11;
	int i2=i;
	i=12;
	int i3=i;
    i=10;

	   
	   System.out.println("name:"+i1);	 
	   System.out.println("name:"+i2);	 
	   System.out.println("name:"+i3);	 
	   
	   
	   
   }
}
